<template>
  <div class="comment">
    <div class="title">
      <div v-if="text=='更多跟帖'">
        <span class="iconfont iconicon-test" @click="shut"></span>
        <!-- <van-icon name="close" size="8.333vw" /> -->
        <span v-if="comment_length==0">暂无评论</span>
        <span v-else>{{comment_length}}条评论</span>
      </div>
      <h4 v-else>{{text}}</h4>
    </div>

    <div>
      <div class="font" v-if="data.length==0">暂无跟帖,抢占沙发</div>
      <div v-else>
        <comment
          v-for="(item,index) in data"
          :key="index"
          :datas="item"
          @reply="reply"
          @replys="replys"
          :replyS="replyS"
        />
      </div>
    </div>
  </div>
</template>

<script>
// import comment from "../components/comment";
export default {
  props: ["data", "text", "comment_length", "replyS"],
  data() {
    return {};
  },
  components: {
    comment: () => import("../components/comment")
  },
  methods: {
    reply(dataId) {
      // console.log(dataId);

      this.$emit("reply", dataId);
    },
    replys(dataId) {
      // console.log(dataId);

      this.$emit("replys", dataId);
    },
    shut() {
      this.$emit("shut");
    }
  }
};
</script>

<style lang="less" scoped>
h4 {
  margin: 20px 0 10px 0;
  text-align: center;
  font-weight: 400;
}
// .end {
//   margin-top: 100px;
//   background-color: red;
// }

.title {
  text-align: center;
  padding-bottom: 15px;
  border-bottom: 1px solid #888;
}
// .length {
//   text-align: center;
//   position: fixed;
//   top: 10px;
// }
.font {
  height: 100px;
  text-align: center;
  font-size: 20px;
  color: #ccc;
  padding-top: 30px;
  line-height: 100px;
}
</style>
